package com.base.day5;

public class Account {
	//余额
	private double balance;
	//户主
	private User owner;
	
	public Account(double d,User u){
		this.balance=d;
		this.owner=u;
	}
	
	//转出
	public double output(Account target,double amt){
		if(amt>this.balance){
			System.out.println("余额不足");
		}else{
			this.balance=this.balance-amt;
			target.input(amt);
		}
		return this.balance;
	}
	
	//转入
		public double input(double amt){
			this.balance=this.balance+amt;
			return this.balance;
		}

		public double getBalance() {
			return balance;
		}

		public void setBalance(double balance) {
			this.balance = balance;
		}

		public User getOwner() {
			return owner;
		}

		public void setOwner(User owner) {
			this.owner = owner;
		}
		
		

}
